<?php 
	namespace Index\Model;
	use Think\Model;
/**
 * 用户表模型
 */
	class UserModel extends Model {		
		public function checkEmail($email)
		{		

			//邮箱正则
			$preg="/^[\w][\w]{2,18}@+[\w]{2,8}.+[com|cn]$/";
			$data=preg_match($preg, $email);
			if ($data) {
				$res=M('user')->where("email='$email'")->find();
					if ($res) {
							Reajax(1,"邮箱已注册");
						}
			}else{
				Reajax(1,"邮箱不合格式");
			}
			
			// var_dump($res);
			

		}
		public function checkNickname($nickname)
		{		

			$res=M('user')->where("nickname='$nickname'")->find();

			if ($res) {
				Reajax(1,"昵称已注册");
			}
			
		}
		public function hotytime()
		{
			return $this->field('id,answer_num,face,nickname,create_time')->order('answer_num desc')->limit(10)->select();
		}
		

	};




 ?>